package com.company.OfferGuide;

import com.company.TreeNode;

public class 对称的二叉树 {

    public boolean isSymmetric(TreeNode root) {
        if (root == null) return true;
        return helpJudege(root,root);
    }

    public boolean helpJudege(TreeNode node1,TreeNode node2) {
        if (node1 == null && node2 == null) return true;
        else if (node1 == null || node2 == null) return false;

        if (node1.val != node2.val) return false;

        return helpJudege(node1.left,node2.right) && helpJudege(node1.right,node2.left);
    }

}
